﻿using CommonType;
using MediatR;
using S_Gridding.Domains.FoundGridding;
using S_Gridding.Infrastructure.Interface.IRead;
using S_Gridding.Read.Api.Application.Commands;
using S_Userinfor.Domains;

namespace S_Gridding.Read.Api.Application.CommandsHanders
{
    public class CellgridUpdCommandsHanders : IRequestHandler<CellgridUpdCommands, Cellgrid>
    {
        private readonly IDCellgridRepository _repository;

        public CellgridUpdCommandsHanders(IDCellgridRepository repository)
        {
            _repository = repository;
        }

        public async Task<Cellgrid> Handle(CellgridUpdCommands request, CancellationToken cancellationToken)
        {
            string sql = "SELECT * FROM Cellgrid WHERE Id = @Id";
            return await _repository.GetOne(request.Id, sql);
        }
    }
}
